#!/bin/bash -e
NUNIT_VERSION=3.16.3
MYDIR="$(dirname $0)"
PACKAGES_PATH=

function get_path()
{
	shift
	echo $*
}

if [ -n "${NUGET_PACKAGES}" ]; then
	PACKAGES_PATH="${NUGET_PACKAGES}"
fi

if [ -z "${PACKAGES_PATH}" ]; then
	NUGET_PATH="dotnet nuget"
	PACKAGES_PATH="$(get_path $(${NUGET_PATH} locals --list global-packages))"
fi

if [ -z "${PACKAGES_PATH}" ]; then
	PACKAGES_PATH="$HOME/.nuget/packages/"
fi

exec mono "${PACKAGES_PATH}/nunit.consolerunner/${NUNIT_VERSION}/tools/nunit3-console.exe" "$@"
